#ifndef FILELIST_DETECTOR_PAGE
#define FILELIST_DETECTOR_PAGE

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PropPage.h"
#include "ExListViewCtrl.h"
#include "../client/ClientProfileManager.h"
class FileListDetectorProfile;

class FileListDetectorPage : public CPropertyPage<IDD_FILELIST_DETECTOR_PAGE>, public PropPage
{
public:
	FileListDetectorPage(SettingsManager *s) : PropPage(s) { 
		SetTitle(CTSTRING(FILELIST_DETECTOR));
	};

	virtual ~FileListDetectorPage() { 
		ctrlProfiles.Detach();
	};

	BEGIN_MSG_MAP(FileListDetectorPage)
		MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
		COMMAND_ID_HANDLER(IDC_ADD, onAdd)
		COMMAND_ID_HANDLER(IDC_REMOVE, onRemove)
		COMMAND_ID_HANDLER(IDC_CHANGE, onChange)
		NOTIFY_HANDLER(IDC_FILELIST_DETECTOR_LIST, NM_DBLCLK, onDblClick)
	END_MSG_MAP()

	LRESULT onInitDialog(UINT, WPARAM, LPARAM, BOOL&);

	LRESULT onAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT onChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT onRemove(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

	LRESULT onDblClick(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& bHandled) {
		return onChange(0, 0, 0, bHandled);
	}

	// Common PropPage interface
	PROPSHEETPAGE *getPSP() { return (PROPSHEETPAGE *)*this; }
	virtual void write();
	
protected:
	ExListViewCtrl ctrlProfiles;

	static Item items[];
	static TextItem texts[];

	void addEntry(const FileListDetectorProfile& fd, int pos);
	//Sulan start svn209
	CComboBox cRaw;
	void fillCombo(){
		for(int n=0;n<11;){
			cRaw.AddString(RAWSETTING(n).c_str());
			++n;
		}
	}
	//End
};

#endif //FILELIST_DETECTOR_PAGE_H